package com.ciis.system.scrite.controller;

import com.ciis.system.scrite.service.ILoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * User: zhangdajun
 * Date: 14-4-22
 * Time: 下午9:48
 * To change this template use File | Settings | File Templates.
 */
@Controller
@RequestMapping("/index")
public class LoginController extends WebInitController {

    @Autowired
    private ILoginService loginService;

    @RequestMapping("/intoLogin")
    private String intoLogin() throws Exception{
        loginService.saveLoginInfo();
        return "/login";
    }

    @RequestMapping("/login/{userName}/{password}")
    @ResponseBody
    private boolean login(@PathVariable("userName")String userName,@PathVariable(value = "password")String password) throws Exception{
        System.out.println(userName + "," + password);
        return true;
    }

    @RequestMapping("/login2")
    @ResponseBody
    private boolean login2(@RequestParam(value="userName",required = true)String userName,@RequestParam(value="password",required = false) String password) throws Exception{
        System.out.println(userName + "," + password);
        return true;
    }
}
